﻿
Imports System.Object
Imports VSModel
Imports Cls_Common
Partial Class FrontEnd_Control_Menu_MenuLeft
    Inherits System.Web.UI.UserControl
    Dim StoreId As Integer
    Dim CateId As Integer
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            BindToGrid(1)

        End If
    End Sub
    Private Sub BindToGrid(ByVal ipage As Integer)
        Using Data As New VSEntities

            'Add DomainName DUC 09-09-2014
            Dim p = (From q In Data.Products Where q.Domain = DomainName And q.StatusId = 3 _
                                                And q.PublishedDate <= Now() And (q.eEffectiveDate >= Now() _
                                                Or q.eEffectiveDate Is Nothing) _
                                            Order By q.Title Ascending Select q).Take(10).ToList

      
            With rptProduct
                .DataSource = p
                .DataBind()
            End With

        End Using
    End Sub

    Protected Sub rtpProduct_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptProduct.ItemDataBound
        Dim row = CType(e.Item.DataItem, Product)
    
        Dim hplTitle As HyperLink = CType(e.Item.FindControl("hplTitle"), HyperLink)
        hplTitle.Text = row.Title
        hplTitle.NavigateUrl = MainDomain & row.CateID & "/" & row.QueryString & "-" & row.ProductId.ToString & ".html"



    End Sub

   

End Class
